<template>
  <div class="user">
    <!-- 面包屑导航 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>用户</el-breadcrumb-item>
      <el-breadcrumb-item>基本资料</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 基本资料修改 -->
    <el-form
      ref="form"
      :model="sizeForm"
      label-width="80px"
      size="medium "
      label-position="left"
    >
      <!-- 用户名 -->
      <el-form-item :label="$t('message.Username')">
        <el-input v-model="sizeForm.name"></el-input>
        <span class="c-999">建议</span>
      </el-form-item>
      <!-- 密码 -->
      <el-form-item :label="$t('message.Password')">
        <el-input v-model="sizeForm.password"></el-input>
        <span class="c-999">{{ $t("message.Password") }}</span>
      </el-form-item>
      <!-- 性别 -->
      <el-form-item :label="$t('message.Gender')" prop="sex">
        <el-radio-group v-model="sizeForm.sex">
          <el-radio label="1">{{ $t("message.Man") }}</el-radio>
          <el-radio label="0">{{ $t("message.Women") }}</el-radio>
        </el-radio-group>
      </el-form-item>
      <!-- 手机号码 -->
      <el-form-item :label="$t('message.Tel')">
        <el-input v-model="sizeForm.tel"></el-input>
        <span class="c-999">建议</span>
      </el-form-item>
      <!-- 邮箱 -->
      <el-form-item :label="$t('message.Email')">
        <el-input v-model="sizeForm.email"></el-input>
        <span class="c-999">建议</span>
      </el-form-item>
      <!-- 备注 -->
      <el-form-item :label="$t('message.Comments')">
        <el-input type="textarea" v-model="sizeForm.remark"></el-input>
      </el-form-item>
      <!-- 按钮 -->
      <el-form-item size="large">
        <el-button type="primary" @click="onSubmit">{{
          $t("message.Sure")
        }}</el-button>
        <el-button type="danger">{{ $t("message.Rewrite") }}</el-button>
      </el-form-item>
    </el-form>
    <!-- 语言切换 -->
    <div class="cut">
      <el-button slot="reference" @click="changeLangEvent()">{{
        changeLang
      }}</el-button>
    </div>
    <ul>
      <li>{{ $t("message.login") }}</li>
      <li>{{ $t("message.Username") }}</li>
      <li>{{ $t("message.Password") }}</li>
      <li>{{ $t("message.Captcha") }}</li>
      <li>{{ $t("message.Language") }}</li>
      <li>{{ $t("message.zh") }}</li>
      <li>{{ $t("message.en") }}</li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      sizeForm: {
        name: "",
        password: "",
        sex: "1",
        tel: "",
        email: "",
        remark: "",
        delivery: false,
        type: [],
        resource: "",
        desc: ""
      },
      // 语言
      lang: "zh",
      changeLang: "切换English"
    };
  },
  methods: {
    onSubmit() {
      console.log("submit!");
    },
    changeLangEvent() {
      if (this.changeLang == "切换English") {
        this.changeLang = "切换中文";
      } else {
        this.changeLang = "切换English";
      }
      if (this.lang === "zh") {
        this.lang = "en";
        this.$i18n.locale = this.lang;
      } else {
        this.lang = "zh";
        this.$i18n.locale = this.lang;
      }
    }
  }
};
</script>

<style lang="less" scoped>
.el-form {
  margin-top: 20px;
}
/deep/.el-input__inner {
  width: 300px;
}
.el-input {
  display: inline;
  margin-right: 20px;
  /deep/ span {
    color: blue;
  }
}
</style>
